package ui;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;

public class SquareRx {
    
    private Rectangle2D.Double rect;
    
    private Color bgColor = Color.gray;
    private Color robotColor = Color.blue;
    private Color obsColor = Color.red;
    private Color candyColor = Color.pink;
    private Color robotWithCandy = Color.pink;
    
    
	private boolean obstacle_status;
    private boolean robot_status;
    private boolean candy_status;
    private boolean background_status;
    private boolean robot_holding_candy_status;
 
    public SquareRx(int r, int c, Rectangle2D.Double rect) {
        
        this.rect = rect;
        obstacle_status = false;
        robot_status = false;
        candy_status = false;
        background_status = false;
        robot_holding_candy_status = false;
    }
 
    public void draw(Graphics2D g2) {
    	
        
    	if (robot_status)
    		g2.setPaint(robotColor);
    	
    	if (robot_holding_candy_status)
    		g2.setPaint(robotWithCandy);
        
    	if (obstacle_status)
            g2.setPaint(obsColor);   	
    	
    	if (background_status)
            g2.setPaint(bgColor);
    	
        if (candy_status)	{
        	g2.setPaint(candyColor);
        	drawCenteredCircle(g2, (int)rect.getCenterX(), (int)rect.getCenterY(), 13);
        	g2.setPaint(bgColor);
        }        
        else {
        	g2.fill(rect);
        	g2.setPaint(bgColor);
        	g2.draw(rect);
        }
        
    }

    //Draw a circle for the candy instead of a square
    public void drawCenteredCircle(Graphics2D g, int x, int y, int r) {
    	  x = x-(r/2);
    	  y = y-(r/2);
    	  g.fillOval(x,y,r,r);
    }
    
	public boolean isBackground_status() {
		return background_status;
	}

	public void setBackground_status(boolean background_status) {
		this.background_status = background_status;
	}

	public boolean isObstacle_status() {
		return obstacle_status;
	}

	public void setObstacle_status(boolean obstacle_status) {
		this.obstacle_status = obstacle_status;
	}

	public boolean isRobot_status() {
		return robot_status;
	}

	public void setRobot_status(boolean robot_status) {
		this.robot_status = robot_status;
	}

	public boolean isCandy_status() {
		return candy_status;
	}

	public void setCandy_status(boolean candy_status) {
		this.candy_status = candy_status;
	}

	public boolean isRobot_holding_candy_status() {
		return robot_holding_candy_status;
	}

	public void setRobot_holding_candy_status(boolean robot_holding_candy_status) {
		this.robot_holding_candy_status = robot_holding_candy_status;
	}
	
	
 
   
   
}